package com.tieto.user;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

public class UserServiceWebDriverIT {
	private WebDriver browser;
	private String httpPort;

	@Test
	public void testWsdl() {
		// load WSDL page
		browser.get("http://localhost:" + httpPort
				+ "/user-management-web/user-service/userService?wsdl");
		// check that the page contains some valid WSDL
		Assert.assertTrue(browser.getPageSource(), browser.getPageSource()
				.contains("wsdl:operation name=\"findAll\""));
	}

	@Before
	public void setUp() {
		// create HtmlUnitDriver or FireFoxDriver
		browser = new HtmlUnitDriver(true);
		// get tomcat port from system property
		httpPort = System.getProperty("http.port", "8082");
	}

	@After
	public void tearDown() {
		browser.close();
	}
}
